Integrand size = 23, antiderivative size = 67 \[ \int \frac {A+B \sec (c+d x)}{a+b \sec (c+d x)} \, dx=\frac {A x}{a}-\frac {2 (A b-a B) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b} d} \]
[Out]
Time = 0.12 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {4004, 3916, 2738, 214} \[ \int \frac {A+B \sec (c+d x)}{a+b \sec (c+d x)} \, dx=\frac {A x}{a}-\frac {2 (A b-a B) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d \sqrt {a-b} \sqrt {a+b}} \]
[In]
[Out]
Rule 214
Rule 2738
Rule 3916
Rule 4004
Rubi steps \begin{align*} \text {integral}& = \frac {A x}{a}-\frac {(A b-a B) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)} \, dx}{a} \\ & = \frac {A x}{a}-\frac {(A b-a B) \int \frac {1}{1+\frac {a \cos (c+d x)}{b}} \, dx}{a b} \\ & = \frac {A x}{a}-\frac {(2 (A b-a B)) \text {Subst}\left (\int \frac {1}{1+\frac {a}{b}+\left (1-\frac {a}{b}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{a b d} \\ & = \frac {A x}{a}-\frac {2 (A b-a B) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b} d} \\ \end{align*}
Time = 0.17 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.01 \[ \int \frac {A+B \sec (c+d x)}{a+b \sec (c+d x)} \, dx=\frac {A (c+d x)+\frac {2 (A b-a B) \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}}{a d} \]
[In]
[Out]
Time = 0.80 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.09
method | result | size |
derivativedivides | \(\frac {-\frac {2 \left (A b -B a \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 A \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}}{d}\) | \(73\) |
default | \(\frac {-\frac {2 \left (A b -B a \right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 A \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}}{d}\) | \(73\) |
risch | \(\frac {A x}{a}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) A b}{\sqrt {a^{2}-b^{2}}\, d a}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) A b}{\sqrt {a^{2}-b^{2}}\, d a}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+b \sqrt {a^{2}-b^{2}}}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, d}\) | \(294\) |
[In]
[Out]
none
Time = 0.30 (sec) , antiderivative size = 250, normalized size of antiderivative = 3.73 \[ \int \frac {A+B \sec (c+d x)}{a+b \sec (c+d x)} \, dx=\left [\frac {2 \, {\left (A a^{2} - A b^{2}\right )} d x - {\left (B a - A b\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right )}{2 \, {\left (a^{3} - a b^{2}\right )} d}, \frac {{\left (A a^{2} - A b^{2}\right )} d x + {\left (B a - A b\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right )}{{\left (a^{3} - a b^{2}\right )} d}\right ] \]
[In]
[Out]
\[ \int \frac {A+B \sec (c+d x)}{a+b \sec (c+d x)} \, dx=\int \frac {A + B \sec {\left (c + d x \right )}}{a + b \sec {\left (c + d x \right )}}\, dx \]
[In]
[Out]
Exception generated. \[ \int \frac {A+B \sec (c+d x)}{a+b \sec (c+d x)} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 274 vs. \(2 (58) = 116\).
Time = 0.33 (sec) , antiderivative size = 274, normalized size of antiderivative = 4.09 \[ \int \frac {A+B \sec (c+d x)}{a+b \sec (c+d x)} \, dx=\frac {\frac {{\left (\sqrt {-a^{2} + b^{2}} A {\left (a - 2 \, b\right )} {\left | -a + b \right |} + \sqrt {-a^{2} + b^{2}} B a {\left | -a + b \right |} - \sqrt {-a^{2} + b^{2}} A {\left | a \right |} {\left | -a + b \right |} + \sqrt {-a^{2} + b^{2}} B {\left | a \right |} {\left | -a + b \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-\frac {b + \sqrt {{\left (a + b\right )} {\left (a - b\right )} + b^{2}}}{a - b}}}\right )\right )}}{{\left (a^{2} - 2 \, a b + b^{2}\right )} a^{2} + {\left (a^{2} b - 2 \, a b^{2} + b^{3}\right )} {\left | a \right |}} + \frac {{\left (A a + B a - 2 \, A b + A {\left | a \right |} - B {\left | a \right |}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor + \arctan \left (\frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-\frac {b - \sqrt {{\left (a + b\right )} {\left (a - b\right )} + b^{2}}}{a - b}}}\right )\right )}}{a^{2} - b {\left | a \right |}}}{d} \]
[In]
[Out]
Time = 15.47 (sec) , antiderivative size = 573, normalized size of antiderivative = 8.55 \[ \int \frac {A+B \sec (c+d x)}{a+b \sec (c+d x)} \, dx=\frac {2\,A\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^2-b^2\right )}-\frac {B\,\ln \left (\frac {a\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+b\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\sqrt {\left (a+b\right )\,\left (a-b\right )}}{d\,\left (a^2-b^2\right )}+\frac {B\,a^2\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,{\left (a^2-b^2\right )}^{3/2}}-\frac {B\,b^2\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,{\left (a^2-b^2\right )}^{3/2}}-\frac {2\,A\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{a\,d\,\left (a^2-b^2\right )}+\frac {A\,b^3\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{a\,d\,{\left (a^2-b^2\right )}^{3/2}}-\frac {A\,a\,b\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,{\left (a^2-b^2\right )}^{3/2}}+\frac {A\,b\,\ln \left (\frac {a\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+b\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {a^2-b^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\sqrt {\left (a+b\right )\,\left (a-b\right )}}{a\,d\,\left (a^2-b^2\right )} \]
[In]
[Out]